<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <common-head></common-head>
   
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const  app = createApp()
    const CommonNav = {
          template: `
            <div>
              <h2>这是子组件</h2>
              {{ msg }}
            </div>
          `,
          data() {
            return {
              msg: '子组件数据'
            }
          },
        }
    const CommonHead = {
      // 模板 组件 视图结构 （html标签结构）
      template: `
        <div>
          <h1>这是父组件</h1>  
          {{ msg }}
          <common-nav></common-nav>
        </div>
      `,
      data() {
        return {
          msg: '组件的数据'
        }
      },
      // 父组件内部 新增 components
      components: {
        CommonNav
      }
    }
    app.component("CommonHead", CommonHead)
    app.mount('#app')
  </script>
</body>
</html>